<template>
  <div v-loading="dataLoading" class="container flex flex_column">
    <!--    顶部导航条-->
    <div class="topNav flex flex_between">
      <div>
        <span class="back mr10 pointer" @click="Back"
          ><i class="el-icon-arrow-left" /> 返回</span
        >
        <span class="fw">机台任务</span>
      </div>
    </div>
    <div class="mainCenter">
      <el-form
        ref="orderForm"
        label-position="left"
        :model="productFrom"
        :rules="rules"
        label-width="110px"
        class="orderForm flex flex_between"
      >
        <div class="leftCon">
          <div class="d_orderDetails">
            <div class="item">
              <div class="cTitle">
                <h3>订单信息</h3>
              </div>
              <dl>
                <dt>订单单号</dt>
                <dd>{{ productFrom.baseData.xieYiShuHao || "--" }}</dd>
              </dl>
              <dl>
                <dt>订单类型</dt>
                <dd>{{ productFrom.baseData.orderTypeName || "--" }}</dd>
              </dl>
              <dl>
                <dt>客户单号</dt>
                <dd>{{ productFrom.baseData.customerBillNo || "--" }}</dd>
              </dl>
              <dl>
                <dt>合同号</dt>
                <dd>{{ productFrom.baseData.contractCode || "--" }}</dd>
              </dl>
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>产品信息</h3>
              </div>
              <dl>
                <dt>产品名称</dt>
                <dd>{{ productFrom.baseData.orderProductName || "--" }}</dd>
              </dl>
              <dl>
                <dt>产品板面</dt>
                <dd>{{ productFrom.baseData.printingSurface || "--" }}</dd>
              </dl>
              <dl>
                <dt>产品版本</dt>
                <dd>{{ productFrom.baseData.productVersions || "--" }}</dd>
              </dl>
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>业务信息</h3>
              </div>
              <dl>
                <dt>标签套数</dt>
                <dd>
                  {{ productFrom.baseData.taoZhuangQuantity || "--"
                  }}<span class="unit">{{
                    productFrom.baseData.taoZhuangQuantity ==
                    productFrom.baseData.tagSumQuantity
                      ? "枚"
                      : "套"
                  }}</span>
                </dd>
              </dl>
              <dl>
                <dt>标签枚数</dt>
                <dd>
                  {{ productFrom.baseData.tagSumQuantity || "--"
                  }}<span class="unit">枚</span>
                </dd>
              </dl>
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>数据信息</h3>
              </div>
              <dl>
                <dt>数据来源</dt>
                <dd>{{ productFrom.baseData.dataComeFromName || "--" }}</dd>
              </dl>
              <dl>
                <dt>数据数量</dt>
                <dd>{{ productFrom.baseData.tagDataQuantity || "--" }}</dd>
              </dl>
              <dl>
                <dt>数据状态</dt>
                <dd>{{ productFrom.baseData.dataProduceState || "--" }}</dd>
              </dl>
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>套装关系</h3>
              </div>
              <labelTree :tree-data="productFrom.packageRelations" />
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>产品包装</h3>
              </div>
              <dl>
                <dt>成品样式</dt>
                <dd>{{ productFrom.productData.productStyleName || "--" }}</dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle !== 1">
                <dt>出标方向</dt>
                <dd>{{ productFrom.productData.outDirectionName || "--" }}</dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle === 2">
                <dt>卷向</dt>
                <dd>
                  {{ productFrom.productData.scrollDirectionName || "--" }}
                </dd>
              </dl>
              <dl>
                <dt>贴标方式</dt>
                <dd>{{ productFrom.productData.tagAffixWayName || "--" }}</dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle === 2">
                <dt>卷芯大小</dt>
                <dd>
                  {{ productFrom.productData.mandrelSize || "--"
                  }}<span class="unit">mm</span>
                </dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle === 2">
                <dt>外直径不超过</dt>
                <dd>
                  {{ productFrom.productData.notOverDiameter || "--"
                  }}<span class="unit">mm</span>
                </dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle === 2">
                <dt>每卷等于</dt>
                <dd>
                  {{ productFrom.productData.pageEqualTags || "--"
                  }}<span class="unit">{{
                    productFrom.baseData.taoZhuangQuantity ==
                    productFrom.baseData.tagSumQuantity
                      ? "枚"
                      : "套"
                  }}</span>
                </dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle !== 2">
                <dt>每张等于</dt>
                <dd>
                  {{ productFrom.productData.pageEqualTags || "--"
                  }}<span class="unit">{{
                    productFrom.baseData.taoZhuangQuantity ==
                    productFrom.baseData.tagSumQuantity
                      ? "枚"
                      : "套"
                  }}</span>
                </dd>
              </dl>
              <dl v-if="productFrom.productData.productStyle !== 2">
                <dt>每包等于</dt>
                <dd>
                  {{ productFrom.productData.packageEqualPages || "--"
                  }}<span class="unit">张</span>
                </dd>
              </dl>
              <dl>
                <dt>每箱等于</dt>
                <dd>
                  {{ productFrom.productData.boxEqualPackages || "--"
                  }}<span class="unit">{{
                    productFrom.productData.productStyle !== 2 ? "包" : "卷"
                  }}</span>
                </dd>
              </dl>
              <dl>
                <dt>每箱共计</dt>
                <dd>
                  {{ productFrom.productData.boxEqualTags || "--"
                  }}<span class="unit">{{
                    productFrom.baseData.taoZhuangQuantity ==
                    productFrom.baseData.tagSumQuantity
                      ? "枚"
                      : "套"
                  }}</span>
                </dd>
              </dl>
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>订单备注</h3>
              </div>
              <div class="d_remark">
                {{ productFrom.baseData.orderRemark }}
              </div>
            </div>
            <div class="item">
              <div class="cTitle">
                <h3>其他信息</h3>
              </div>
              <dl>
                <dt>业务员</dt>
                <dd>{{ productFrom.baseData.salesmanName || "--" }}</dd>
              </dl>
              <dl>
                <dt>联系电话</dt>
                <dd>{{ productFrom.baseData.salesmanMobile || "--" }}</dd>
              </dl>
            </div>
          </div>
        </div>
        <div class="flex flex_between h100 cwapper">
          <div class="infoSCDD w100">
            <span>生产单号: {{ selectDD.produceTaskBillNo }}</span>
            <span>生产类型: {{ selectDD.produceBillTypeName }}</span>
            <span>生产状态: {{ selectDD.taskProduceStateName }}</span>
            <span>生产时间: {{ selectDD.createDate }}</span>
            <span>开单人员: {{ selectDD.createPersonName }}</span>
          </div>
          <div class="flex w100 vss">
            <div class="cenCon">
              <div class="cHeader f16">任务列表</div>
              <div class="itemCenter">
                <div
                  v-for="item in productList"
                  :key="item.produceTaskBillNo"
                  class="cenItem"
                >
                  <div class="lNavt flex flex_between">
                    <div class="itemCon flex_between">
                      <span>{{ item.produceTaskBillNo }}</span>

                      <span class="pointer listItem" @click="shrink(item)">
                        <i v-if="item.isShow" class="el-icon-arrow-down" />
                        <i v-else class="el-icon-arrow-up" />
                      </span>
                    </div>
                  </div>
                  <div v-show="item.isShow">
                    <div
                      v-for="(craft, index) in item.craftTaskList"
                      :key="craft.craftTaskID"
                      class="carftItem"
                      :class="
                        craft.craftTaskNo === selectItem.craftTaskNo
                          ? 'active'
                          : ''
                      "
                      @click="chsngeSelect(craft, item)"
                    >
                      <div class="name">
                        <span class="intax">{{ index + 1 }}</span
                        ><span class="name_text f14">{{
                          craft.produceCraftName
                        }}</span>
                      </div>
                      <div>计划用时:{{ craft.craftTaskPlanUseTime }}</div>
                      <div>工艺状态:{{ craft.craftTaskStateName }}</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="cenright">
              <!--   拼版信息  生产物料 生产工艺-->
              <picking :per-visible.sync="showPicking" :equipmentNo="$route.query.equipmentNo" :produceTaskBillNo="$route.query.produceTaskBillNo"></picking>
              <returnMaterial :per-visible.sync="showMaterial" :equipmentNo="$route.query.equipmentNo" :produceTaskBillNo="$route.query.produceTaskBillNo"></returnMaterial>
              <div class="tagsRgBox">
                <div class="cHeader f16">任务明细</div>
                <div class="zy_add flex_between flex">
                  <div>
                    <el-button
                      v-show="selectItem.craftTaskState !== 2"
                      class="mr5"
                      size="small"
                      icon="el-icon-plus"
                      type="primary"
                      @click="productCopy()"
                      v-permission="'MenuCode4-2-1'"
                      >新增作业
                    </el-button>
                    <el-button
                      class="mr5"
                      size="small"
                      @click="showPicking = true"
                      v-if="selectDD.taskProduceStateName!='已停工'"
                      v-permission="'MenuCode4-2-2'"
                      >生产领料
                    </el-button>
                    <el-button
                      class="mr5"
                      size="small"
                      @click="showMaterial = true"
                      v-permission="'MenuCode4-2-3'"
                      >生产退料
                    </el-button>
                  </div>
                  <div>
                    <el-button
                      v-show="selectItem.craftTaskState === 1"
                      class=""
                      size="small"
                      icon="el-icon-check"
                      type="success"
                      @click="fnishGY"
                      v-permission="'MenuCode4-2-4'"
                      >完成该工艺
                    </el-button>
                  </div>
                </div>
                <div v-if="selectItem" class="tabCon">
                  <div>
                    <div
                      v-for="zy in selectItem.workTaskList"
                      :key="zy.workTaskNo"
                      class="zy_item"
                    >
                      <div class="zy_header flex_between">
                        <div>
                          <span>作业单号:{{ zy.workTaskNo }}</span>
                          <span>作业状态:{{ zy.craftWorkStateName }}</span>
                          <span>作业人员:{{ zy.workPersonName }}</span>
                        </div>
                        <div>
                          <el-button
                            v-show="zy.craftWorkState === 1"
                            class=""
                            size="mini"
                            icon="el-icon-view"
                            @click="checkWork(zy)"
                            >查看
                          </el-button>
                          <el-button
                            v-show="selectItem.craftTaskState == 1"
                            class=""
                            size="mini"
                            icon="el-icon-edit"
                            v-permission="'MenuCode4-2-5'"
                            @click="print(zy)"
                            >修改
                          </el-button>
                          <el-button
                            class=""
                            size="mini"
                            icon="el-icon-delete"
                            @click="stopOne(zy)"
                            v-permission="'MenuCode4-2-6'"
                            >删除
                          </el-button>
                          <el-button
                            v-show="zy.craftWorkState === 0"
                            class=""
                            size="mini"
                            type="primary"
                            @click="doneWork(zy)"
                            v-permission="'MenuCode4-2-7'"
                            >完成作业
                          </el-button>
                        </div>
                      </div>
                      <div class="zy_info">
                        <div class="divt">
                          开始时间:{{ zy.workBeginTime || "--" }}
                        </div>
                        <div class="divt">
                          结束时间:{{ zy.workFinishTime || "--" }}
                        </div>
                        <div class="divt">
                          产品耗时:{{ zy.taskUseTime || "--" }}
                        </div>
                        <div class="divt">
                          上班班次:{{ zy.workShiftName || "--" }}
                        </div>
                        <div class="divt">
                          副手人员:
                          <span
                            v-for="v in zy.assistantList"
                            :key="v.employeeCode"
                          >
                            {{ v.employeeName || "--" }}
                          </span>
                        </div>
                        <div class="divt">
                          生产工时:{{ zy.actualWorkTime || "--" }}
                        </div>
                        <div class="divt">
                          作业备注:{{ zy.workTaskRemark || "--" }}
                        </div>
                        <div
                          v-show="zy.exceptionDataList.length > 0"
                          class="cot"
                        >
                          <div ref="bigdialogTable" class="bigdialogTbCon">
                            <div class="ht">
                              <span class="f16">异常明细</span>
                            </div>
                            <el-table
                              :data="zy.exceptionDataList"
                              border
                              style="width: 100%"
                            >
                              <el-table-column
                                type="index"
                                label="序号"
                                width="100"
                              />
                              <el-table-column
                                label="卷号"
                                prop="reelNumber"
                                show-overflow-tooltip
                                width="100"
                              >
                              </el-table-column>
                              <el-table-column
                                label="开始页码"
                                prop="beginPageNo"
                                show-overflow-tooltip
                                width="100"
                              >
                              </el-table-column>
                              <el-table-column
                                label="结束页码"
                                prop="endPageNo"
                                show-overflow-tooltip
                                width="100"
                              >
                              </el-table-column>
                              <el-table-column
                                label="异常原因"
                                prop="exceptionReasonName"
                                show-overflow-tooltip
                                width="230"
                              >
                              </el-table-column>
                              <el-table-column
                                label="备注"
                                show-overflow-tooltip
                                min-width="150"
                                prop="exceptionRemark"
                              >
                              </el-table-column>
                            </el-table>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div v-else>
                  <el-empty description="暂无数据" />
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-form>
    </div>

    <!-- 完成机台作业   -->
    <el-dialog
      :title="Matitle"
      :visible.sync="showAddDialog"
      :close-on-click-modal="false"
      custom-class="bodyNoPadDialog bigDialog bigDialogh85"
      width="85%"
    >
      <div class="dialogDody">
        <div class="subTipBtn">
          <span class="mr15"
            ><span class="mr5">作业单号：</span
            >{{ machiaForm.workTaskNo || "系统自动生成" }}</span
          >
          <span class="mr15"
            ><span class="mr5">创建日期：</span
            >{{
              machiaForm.workBeginTime || dayjs().format("YYYY-MM-DD")
            }}</span
          >
          <span
            ><span class="mr5">创建人员：</span
            >{{
              machiaForm.workPersonName
            }}</span
          >
        </div>
        <el-form
          ref="machiaForm"
          :model="machiaForm"
          class="dialogForm h100"
          label-width="80px"
        >
          <el-row class="h100">
            <el-col :span="18" class="fleft h100">
              <el-row>
                <el-col :span="8"
                  ><el-form-item label="订单单号" prop="xieYiShuHao">
                    <el-input
                      v-model="machiaForm.xieYiShuHao"
                      size="mini"
                      disabled /></el-form-item
                ></el-col>
                <el-col :span="8"
                  ><el-form-item label="生产单号" prop="produceTaskBillNo">
                    <el-input
                      v-model="machiaForm.produceTaskBillNo"
                      size="mini"
                      disabled /></el-form-item
                ></el-col>
                <el-col :span="8"
                  ><el-form-item label="作业单号" prop="workTaskNo">
                    <el-input
                      v-model="machiaForm.workTaskNo"
                      size="mini"
                      disabled /></el-form-item
                ></el-col>
              </el-row>
              <el-row>
                <el-col :span="8"
                  ><el-form-item label="产品名称" prop="orderProductName">
                    <el-input
                      v-model="machiaForm.orderProductName"
                      size="mini"
                      disabled /></el-form-item
                ></el-col>
                <el-col :span="8"
                  ><el-form-item label="工艺名称" prop="produceCraftName">
                    <el-input
                      v-model="machiaForm.produceCraftName"
                      size="mini"
                      disabled
                    /> </el-form-item
                ></el-col>
                <el-col :span="8"
                  ><el-form-item label="操作人员" prop="workPersonName">
                    <el-input
                      v-model="machiaForm.workPersonName"
                      size="mini"
                      disabled
                    /> </el-form-item
                ></el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="机台名称" prop="produceMachineName">
                    <el-input
                      v-model="machiaForm.produceMachineName"
                      size="mini"
                      disabled
                    /> </el-form-item
                ></el-col>
                <el-col :span="8">
                  <el-form-item label="生产设备" prop="equipmentCode">
                    <!-- <el-input
                      v-model="machiaForm.equipmentName"
                      size="mini"
                      :disabled="canDisablle"
                    />  -->
                    <el-select
                        filterable
                      v-model="machiaForm.equipmentCode"
                      size="mini"
                      placeholder="请选择生产设备"
                      :disabled="allcanDisablle || equipment.length<1"
                    >
                      <el-option
                        v-for="item in equipment"
                        :key="item.equipmentNo"
                        :label="item.equipmentName"
                        :value="item.equipmentNo"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="副手人员" prop="assistantList">
                    <div class="flex permain">
                      <div class="input">
                        <span
                          v-for="(v, p) in assisList"
                          :key="v.employeeCode"
                          class="pointer"
                          @click="deletrPer(p)"
                        >
                          {{ v.employeeName }}<i class="el-icon-close" />
                        </span>
                      </div>
                      <el-button
                        class="bgc57"
                        size="mini"
                        icon="el-icon-user"
                        @click="openPer"
                      />
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="作业备注" prop="workTaskRemark">
                    <el-input
                      v-model="machiaForm.workTaskRemark"
                      type="textarea"
                      :rows="3"
                      size="mini"
                      :disabled="allcanDisablle"
                    /> </el-form-item
                ></el-col>
              </el-row>
              <template v-if="type == '印刷'">
                <el-row>
                  <div class="cTitle">
                    <h3>作业信息</h3>
                  </div>
                  <el-col :span="8"
                    ><el-form-item label="计划米数" prop="planMeters">
                      <el-input
                        v-model="machiaForm.planMeters"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >

                  <el-col :span="8"
                    ><el-form-item label="生产米数" prop="produceMeters">
                      <el-input
                        v-model="machiaForm.produceMeters"
                        onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                        size="mini"
                        :disabled="allcanDisablle"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="完成卷数" prop="finishedRollCount">
                      <el-input
                        v-model="machiaForm.finishedRollCount"
                        onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                        size="mini"
                        :disabled="allcanDisablle"
                        @blur="productMeter"
                      >
                        <template slot="append">卷</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <div class="cTitle">
                  <h3>主料明细</h3>
                </div>
                <el-table
                  :data="machiaForm.mainMaterialDataList"
                  border
                  style="width: 100%"
                >
                  <el-table-column prop="stockGoodsCode" label="物料编号">
                  </el-table-column>
                  <el-table-column prop="goodsName" label="物料名称">
                  </el-table-column>
                  <el-table-column prop="stockGoodsName" label="规格型号">
                  </el-table-column>
                  <el-table-column prop="planUseQuantity" label="计划用料">
                  </el-table-column>
                  <el-table-column prop="printUseQuantity" label="打印用料">
                  </el-table-column>
                  <el-table-column prop="produceGetQuantity" label="领料数量">
                  </el-table-column>
                  <el-table-column prop="replenishQuantity" label="补料数量">
                  </el-table-column>
                  <el-table-column prop="usedSumQuantity" label="已使用数量">
                  </el-table-column>
                  <el-table-column prop="goodsUnitName" label="单位">
                  </el-table-column>
                  <el-table-column prop="usedQuantity" label="使用数量">
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.usedQuantity"
                        placeholder="请输入"
                        size="mini"
                        type="number"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
                <div class="cTitle">
                  <h3>辅料明细</h3>
                  <div class="operations" v-if="!allcanDisablle">
                    <span @click="showMateria = true"
                      ><i class="el-icon-circle-plus-outline"></i>选择物料</span
                    >|<span @click="handleDeleteMaterial"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>
                <el-table
                  :data="machiaForm.ingredientsDataList"
                  @selection-change="handleMaterialChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column prop="stockGoodsCode" label="物料编号">
                  </el-table-column>
                  <el-table-column prop="goodsName" label="物料名称">
                  </el-table-column>
                  <el-table-column prop="goodsUnitName" label="单位">
                  </el-table-column>
                  <el-table-column prop="usedQuantity" label="使用数量">
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.usedQuantity"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations" v-if="!allcanDisablle">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        multiple
                        size="mini"
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>

              <!-- 制版 -->
              <!-- <el-row>
              <div class="cTitle">
                <h3>申请信息</h3>
              </div>
                <el-col :span="8"
                  ><el-form-item label="申请单号" prop="productMeter">
                    <el-input
                      v-model="machiaForm.productMeters"
                      disabled
                      size="mini"
                    >
                     </el-input
                    >
                  </el-form-item></el-col
                >

                <el-col :span="8"
                  ><el-form-item label="版数" prop="finishedMeters">
                    <el-input
                      v-model="machiaForm.produceMeters"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
                <el-col :span="8"
                  ><el-form-item label="版面" prop="finishedRollCount">
                    <el-input
                      v-model="machiaForm.finishedRollCount"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
              </el-row>
              <el-row>
                <el-col :span="8"
                  ><el-form-item label="申请机台" prop="finishedMeters">
                    <el-input
                      v-model="machiaForm.produceMeters"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
                <el-col :span="8"
                  ><el-form-item label="申请人员" prop="finishedMeters">
                    <el-input
                      v-model="machiaForm.produceMeters"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
              </el-row>
              <div class="cTitle">
                <h3>作业信息</h3>
              </div>
              <el-row>
                <el-col :span="8"
                  ><el-form-item label="刀版编号" prop="productMeter">
                    <el-input
                      v-model="machiaForm.productMeters"
                      size="mini"
                      placeholder="请填写刀版编号"
                      :disabled="allcanDisablle"
                    >
                     </el-input
                    >
                  </el-form-item></el-col
                >

                <el-col :span="8"
                  ><el-form-item label="刀版名称" prop="finishedMeters">
                    <el-input
                      v-model="machiaForm.produceMeters"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      placeholder="请填写刀版名称"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
                <el-col :span="8"
                  ><el-form-item label="刀版尺寸" prop="finishedRollCount">
                    <el-input
                      v-model="machiaForm.finishedRollCount"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      placeholder="请填写刀版尺寸"
                      :disabled="allcanDisablle"
                    >
                      <template slot="append">mm</template></el-input
                    >
                  </el-form-item></el-col
                >
              </el-row>
              <el-row>
                <el-col :span="8"
                  ><el-form-item label="模数" prop="productMeter">
                    <el-input
                      v-model="machiaForm.productMeters"
                      disabled
                      size="mini"
                      placeholder="请填写模数"
                    >
                     </el-input
                    >
                  </el-form-item></el-col
                >

                <el-col :span="8"
                  ><el-form-item label="刀版费用" prop="finishedMeters">
                    <el-input
                      v-model="machiaForm.produceMeters"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      placeholder="请填写刀版费用"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
                <el-col :span="8"
                  ><el-form-item label="存放位置" prop="finishedRollCount">
                    <el-input
                      v-model="machiaForm.finishedRollCount"
                      onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                      size="mini"
                      placeholder="请填写存放位置"
                      :disabled="allcanDisablle"
                    >
                    </el-input
                    >
                  </el-form-item></el-col
                >
              </el-row>
              <el-row>
                <el-col :span="24"
                  ><el-form-item label="制版尺寸" prop="productMeter">
                    <el-input
                      v-model="machiaForm.productMeters"
                      size="mini"
                      :disabled="allcanDisablle"
                      placeholder="尺寸多个用逗号分开，如(小标，中标，大标)"
                    >
                     </el-input
                    >
                  </el-form-item></el-col
                >
              </el-row>
              <el-row>
                <el-col :span="24"
                  ><el-form-item label="刀版备注" prop="productMeter">
                    <el-input
                      v-model="machiaForm.productMeters"
                      size="mini"
                      type="textarea"
                      :disabled="allcanDisablle"
                      :rows="3"
                      placeholder="请填写刀版备注"
                    >
                     </el-input
                    >
                  </el-form-item></el-col
                >
              </el-row> -->

              <template v-if="type == '丝网'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="完成卷数" prop="finishedRollCount">
                      <el-input
                        v-model="machiaForm.finishedRollCount"
                        placeholder="请填写完成卷数"
                        :disabled="allcanDisablle"
                        size="mini"
                      >
                        <template slot="append">卷</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="印面" prop="printFace">
                      <el-input
                        v-model="machiaForm.printFace"
                        placeholder="请填写印面"
                        :disabled="allcanDisablle"
                        size="mini"
                        @blur="calculation"
                      >
                        <template slot="append">mm</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="次数" prop="printCount">
                      <el-input
                        v-model="machiaForm.printCount"
                        placeholder="请填写次数"
                        :disabled="allcanDisablle"
                        @blur="calculation"
                        size="mini"
                      >
                        <template slot="append">次</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="成品米数" prop="sW_ProductMeters">
                      <el-input
                        v-model="machiaForm.sW_ProductMeters"
                        placeholder="请填写次数"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <div class="cTitle">
                  <h3>辅料明细</h3>
                  <div class="operations" v-if="!allcanDisablle">
                    <span @click="showMateria = true"
                      ><i class="el-icon-circle-plus-outline"></i>选择物料</span
                    >|<span @click="handleDeleteMaterial"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>
                <el-table
                  :data="machiaForm.ingredientsDataList"
                  @selection-change="handleMaterialChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column prop="goodsCode" label="物料编号">
                  </el-table-column>
                  <el-table-column prop="goodsName" label="物料名称">
                  </el-table-column>
                  <el-table-column prop="stockGoodsName" label="规格型号">
                  </el-table-column>
                  <el-table-column prop="goodsUnitName" label="单位">
                  </el-table-column>
                  <el-table-column prop="usedQuantity" label="使用数量">
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.usedQuantity"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>

                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        multiple
                        size="mini"
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>

              <template v-if="type == '模切'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="完成卷数" prop="finishedRollCount">
                      <el-input
                        v-model="machiaForm.finishedRollCount"
                        placeholder="请填写完成卷数"
                        :disabled="allcanDisablle"
                        size="mini"
                      >
                        <template slot="append">卷</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="刀版尺寸" prop="knifeVersionSize">
                      <el-input
                        v-model="machiaForm.knifeVersionSize"
                        placeholder="请填写刀版尺寸"
                        :disabled="allcanDisablle"
                        size="mini"
                        @blur="calculation"
                      >
                        <template slot="append">mm</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="模切次数" prop="cutCount">
                      <el-input
                        v-model="machiaForm.cutCount"
                        placeholder="请填写模切次数"
                        :disabled="allcanDisablle"
                        @blur="calculation"
                        size="mini"
                      >
                        <template slot="append">次</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="成品米数" prop="mQ_ProductMeters">
                      <el-input
                        v-model="machiaForm.mQ_ProductMeters"
                        placeholder="请填写次数"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>

                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        size="mini"
                        multiple
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>
              <template v-if="type == '数码'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="完成卷数" prop="finishedRollCount">
                      <el-input
                        v-model="machiaForm.finishedRollCount"
                        placeholder="请填写完成卷数"
                        :disabled="allcanDisablle"
                        size="mini"
                      >
                        <template slot="append">卷</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="打印页数" prop="printPageCount">
                      <el-input
                        v-model="machiaForm.printPageCount"
                        placeholder="请填写打印页数"
                        :disabled="allcanDisablle"
                        size="mini"
                        @blur="calculation"
                      >
                        <template slot="append">页</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="页面大小" prop="printPageSize">
                      <el-input
                        v-model="machiaForm.printPageSize"
                        placeholder="请填写页面大小"
                        :disabled="allcanDisablle"
                        @blur="calculation"
                        size="mini"
                      >
                        <template slot="append">mm</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="成品米数" prop="sM_ProductMeters">
                      <el-input
                        v-model="machiaForm.sM_ProductMeters"
                        placeholder="请填写次数"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>

                <div class="cTitle">
                  <h3>页码明细</h3>
                  <div class="operations">
                    <span @click="handleAddPage"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeletePage"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>
                <el-table
                  :data="machiaForm.pageDetailDataList"
                  @selection-change="handlePageChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="文件名称"
                    prop="pageFileName"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.pageFileName"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="总页数"
                    prop="totalPageCount"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.totalPageCount"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="起始号"
                    prop="beginNo"
                    show-overflow-tooltip
                    width="120"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="截止号"
                    prop="endNo"
                    show-overflow-tooltip
                    width="120"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="remark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.remark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>

                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        size="mini"
                        multiple
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>
              <template v-if="type == '采集'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="完成卷数" prop="finishedRollCount">
                      <el-input
                        v-model="machiaForm.finishedRollCount"
                        placeholder="请填写完成卷数"
                        :disabled="allcanDisablle"
                        size="mini"
                      >
                        <template slot="append">卷</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="每卷数量" prop="everyRollQuantity">
                      <el-input
                        v-model="machiaForm.everyRollQuantity"
                        placeholder="请填写每卷数量"
                        :disabled="allcanDisablle"
                        size="mini"
                        @blur="calculation"
                      >
                        <template slot="append">{{ machiaForm.orderProductUnit }}</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="成品数量" prop="productQuantity">
                      <el-input
                        v-model="machiaForm.productQuantity"
                        placeholder="请填写成品数量"
                        :disabled="allcanDisablle"
                        @blur="calculation"
                        size="mini"
                      >
                        <template slot="append">{{ machiaForm.orderProductUnit }}</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        size="mini"
                        multiple
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>
              <template v-if="type == '检验'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="完成卷数" prop="finishedRollCount">
                      <el-input
                        v-model="machiaForm.finishedRollCount"
                        placeholder="请填写完成卷数"
                        :disabled="allcanDisablle"
                        size="mini"
                      >
                        <template slot="append">卷</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="检验米数" prop="inspectMeters">
                      <el-input
                        v-model="machiaForm.inspectMeters"
                        placeholder="请填写检验米数"
                        :disabled="allcanDisablle"
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="检验数量" prop="inspectCount">
                      <el-input
                        v-model="machiaForm.inspectCount"
                        placeholder="请填写检验数量"
                        :disabled="allcanDisablle"
                        @blur="calculation"
                        size="mini"
                      >
                        <template slot="append">{{ machiaForm.orderProductUnit }}</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <el-row>
                  <el-col :span="8"
                    ><el-form-item label="不良成品" prop="noPassCount">
                      <el-input
                        v-model="machiaForm.noPassCount"
                        placeholder="请填写不良成品"
                        :disabled="allcanDisablle"
                        @blur="calculation"
                        size="mini"
                      >
                        <template slot="append">{{ machiaForm.orderProductUnit }}</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="不合格率" prop="productQuantity">
                      <el-input
                        v-model="machiaForm.percentDefective"
                        placeholder="自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">%</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        size="mini"
                        multiple
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </el-col>
            <el-col :span="6" class="formItem fright">
              <el-form-item label="上班班次" prop="indexNumber">
                <el-select
                        filterable
                  v-model="machiaForm.workShiftNo"
                  :disabled="allcanDisablle"
                  placeholder="请选择"
                  size="mini"
                >
                  <el-option
                    v-for="item in bcList"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="开始时间">
                <el-date-picker
                  v-model="machiaForm.workBeginTime"
                  type="datetime"
                  :picker-options="option"
                  placeholder="选择日期"
                  size="mini"
                  disabled
                />
              </el-form-item>
              <el-form-item label="结束时间">
                <el-date-picker
                  v-model="machiaForm.workFinishTime"
                  type="datetime"
                  :picker-options="option"
                  placeholder="选择日期"
                  size="mini"
                  disabled
                />
              </el-form-item>
              <el-form-item label="产品耗时">
                <el-input
                  v-model="machiaForm.taskUseTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>
              <el-form-item label="其他时间">
                <el-input
                  v-model="machiaForm.otherUseTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  @blur="efficiency"
                  size="mini"
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>
              <el-form-item label="计划工时">
                <el-input
                  v-model="machiaForm.planWorkTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>

              <el-form-item label="标准效率">
                <el-input
                  v-model="machiaForm.standardEfficiency"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">米/小时</template></el-input
                >
              </el-form-item>
              <el-form-item label="生产工时">
                <el-input
                  v-model="machiaForm.actualWorkTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>
              <el-form-item label="工作效率">
                <el-input
                  v-model="machiaForm.workEfficiency"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">米/小时</template></el-input
                >
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" @click="showAddDialog = false">取 消</el-button>
        <!-- 新增       -->
        <el-button
          v-if="opsid !== -1"
          :loading="addLoading"
          :disabled="addLoading"
          element-loading-spinner="el-icon-loading"
          type="primary"
          size="mini"
          @click="saveMachina"
        >
          {{ opsid === 0 ? "完成" : "保存" }}</el-button
        >
      </div>
    </el-dialog>
    <!-- 人员寻找弹框   -->
    <per-redio-dialog
      :per-visible.sync="isperShow"
      @getEmployee="getEmployee"
    />

    <!--   选择物料  -->
    <SelectMateriaList
      ref="materiaList"
      :per-visible.sync="showMateria"
      @getMateriListData="refuseListsMateriAll"
    />
  </div>
</template>
<script>
import SelectCraftlist from "@/components/selectCraft";
import SelectMateriaList from "@/components/selectMaterial";
import labelTree from "@/components/labelTree";
import perRedioDialog from "@/components/perDialogRedio";
import { mapGetters } from "vuex";
import { parseTime } from "@/utils";
import { uuid } from "vue-uuid";
import Sortable from "sortablejs";
import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import picking from "../components/picking"
import returnMaterial from "../components/returnMaterial"
export default {
  name: "",
  components: {
    labelTree,
    SelectCraftlist,
    SelectMateriaList,
    ElImageViewer,
    perRedioDialog,
    picking,
    returnMaterial
  },
  computed: {
    ...mapGetters(["userInfo", "name"]),
  },
  data() {
    return {
      orderInfos: {
        productData: {
          tagDataList: [{}, {}, {}],
        },
      },
      selectItem: {},
      bcList: [],
      isperShow: false,
      addLoading: false,
      cancelForm: {
        cancelReason: "",
        stopWorkReason: "",
        cancelReasonall: "",
      },
      rowID: 0,
      selectArr: [],
      showAddDialog: false,
      machiaForm: [],
      canDisablle: false,
      allcanDisablle: false,
      assisList: [],
      opsid: 0,
      ExceptionTypeList: [],
      isShadeShow: false,
      reasonVisibleall: false,
      addLableLoading: false,
      Matitle: "",
      urlList: [], // 图片列表
      showViewer: false, // 预览图片
      showOrder: false, // 订单弹窗
      showCraft: false, // 选择工艺
      showMateria: false, // 选择物料
      orderNo: "", // 订单号
      loading: null,
      conIndex: 0,
      showPicking:false,  //生产领料
      showMaterial:false, //生产退料
      tabsIndex: 0, // 右侧tabs切换索引
      tagIndex: 0, // 当前标签索引
      colorOps: "add", // 印刷颜色当前操作
      colorEditIndex: null, // 印刷颜色修改的索引
      dataLoading: false, // 订单详情数据加载
      orderLoading: false, // 订单保存加载效果
      isAddColor: false, // 印刷颜色新增弹框是否打开
      reasonDataList: [],
      materiaChecked: [], //辅料明细选中数据
      abnormalChecked: [], //异常明细选中数据
      pageChecked: [], //页码明细选中数据

      // 设置时间控件小于当前日期不能选择
      option: {
        disabledDate: (time) => {
          return time.getTime() < Date.now() - 1 * 24 * 3600 * 1000;
        },
      },
      selectDD: {},
      productFrom: {
        baseData: {},
        packageData: {},
        orderBaseData: {},
        productData: {},
      },
      isDisable: false, // 是否禁用输入框
      stopVisible: false,
      reasonVisible: false,
      typeStatus: 0,
      equipment: "",
      type: "",
      index: 0,
      indexPage: 0,
      productList: [],
      cancelFormrules: {
        cancelReason: [
          { required: true, message: "请输入原因", trigger: "change" },
        ],
      },
      rules: {
        "productBase.customerName": [
          { required: true, message: "请选择客户", trigger: "change" },
        ],
        "productBase.productName": [
          {
            required: true,
            message: "请输入产品名称",
            trigger: ["change", "blur"],
          },
        ],
      },
    };
  },
  created() {
    // this.getTypeStatus()
    this.loading = this.$loading({
      lock: true,
      text: "数据加载中",
      spinner: "el-icon-loading",
      fullscreen: true,
      background: "rgba(0, 0, 0, 0.7)",
    });
    this.type = this.$route.query.type;
    this.getOrderInfo();
    this.getBC();
    this.getWorkExceptionTypeDataList();
    // this.getList()
  },
  deactivated() {
    // localStorage.removeItem('orderInit')
  },
  beforeDestroy() {
    // localStorage.removeItem('orderInit')
  },
  mounted() {},
  methods: {
    // 得到申请人员
    getEmployee(val) {
      //  this.contractForm.contractSigningPerson = val.employeeCode
      // this.contractForm.contractSigningPersonName = val.employeeName

      if (this.assisList.length === 0) {
        this.assisList.push({
          employeeCode: val.employeeCode,
          employeeName: val.employeeName,
        });
      } else {
        const checked = this.assisList.some((item) => {
          if (item.employeeCode === val.employeeCode) {
            return true;
          }
        });
        if (!checked) {
          this.assisList.push({
            employeeCode: val.employeeCode,
            employeeName: val.employeeName,
          });
        }
      }
    },
    deletrPer(index) {
      if (this.allcanDisablle) {
        return;
      } else {
        this.assisList.splice(index, 1);
      }
    },
    openPer() {
      if (this.allcanDisablle) {
        return;
      } else {
        this.isperShow = true;
      }
    },
    getWorkExceptionTypeDataList() {
      this.$api.system.GetWorkExceptionTypeDataList({}).then((res) => {
        this.ExceptionTypeList = res;
      });
    },
    parseTime(time, cFormat) {
      return parseTime(time, cFormat);
    },
    timeFn(d1, d2) {
      if (d1 && d2) {
        // 如果时间格式是正确的，那下面这一步转化时间格式就可以不用了
        const dateBegin = new Date(d1.replace(/-/g, "/")); // 将-转化为/，使用new Date
        const dateEnd = new Date(d2.replace(/-/g, "/")); // 获取当前时间
        const dateDiff = dateEnd.getTime() - dateBegin.getTime(); // 时间差的毫秒数
        const leave1 = dateDiff % (24 * 3600 * 1000); // 计算天数后剩余的毫秒数
        // 计算相差分钟数
        const leave2 = leave1 % (3600 * 1000); // 计算小时数后剩余的毫秒数
        const minutes = Math.floor(leave1 / (60 * 1000)); // 计算相差分钟数
        return minutes;
      }
    },
    saveMachina() {
      const _d = [];
      this.assisList.forEach((e) => {
        _d.push(e.employeeCode);
      });
      this.machiaForm.assistantList = _d;
      if (this.opsid === 0) {
        this.$api.product
          .FinishedProduceCraftWorkTask({ workTaskID: this.rowID })
          .then((res) => {
            this.getList();
            this.showAddDialog = false;
            this.$message({
              type: "success",
              message: "完成成功!",
            });
          });
      } else {
        this.machiaForm.exceptionDataList.forEach((item) => {
        item.beginPageNo = Number(item.beginPageNo);
        item.endPageNo = Number(item.endPageNo);
        item.exceptionReason = item.exceptionReason.join(',')
      });
        this.$api.product
          .UpdateProduceCraftWorkTask(this.machiaForm)
          .then((res) => {
            this.$message({
              type: "success",
              message: "修改成功!",
            });
            this.showAddDialog = false;
            this.getList();
          });
      }
    },

    //选择物料
    refuseListsMateriAll(value) {
      value.forEach((item) => {
        this.machiaForm.ingredientsDataList.push(item);
      });
      this.machiaForm.ingredientsDataList = this.unique(
        this.machiaForm.ingredientsDataList
      );
      // this.machiaForm.ingredientsDataList = value
    },

    unique(arr) {
      const res = new Map();
      return arr.filter(
        (arr) => !res.has(arr.stockGoodsID) && res.set(arr.stockGoodsID, 1)
      );
    },

    checkWork(item3) {
      this.opsid = -1;
      this.Matitle = "查看生产作业";
      this.canDisablle = true;
      this.allcanDisablle = true;
      const _data = {
        workTaskID: item3.workTaskID,
        workTaskNo: item3.workTaskNo,
      };
      this.$api.product.GetProduceCraftWorkTaskDetail(_data).then((res) => {
        this.assisList = res.assistantList;
        this.machiaForm = res.baseData;
        this.machiaForm.exceptionDataList = res.exceptionDataList;
        this.machiaForm.mainMaterialDataList = res.mainMaterialDataList;
        this.machiaForm.ingredientsDataList = res.ingredientsDataList;
        this.machiaForm.pageDetailDataList = res.pageDetailDataList;
        this.reasonDataList = res.exceptionReasonList;
        this.machiaForm.produceUseTime = this.timeFn(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        // this.machiaForm.workShiftNo = 'BC0019'
        this.showAddDialog = true;
      });
    },
    print(item3) {
      this.opsid = 2;
      this.Matitle = "修改生产作业";
      this.canDisablle = true;
      this.allcanDisablle = false;
      const _data = {
        workTaskID: item3.workTaskID,
        workTaskNo: item3.workTaskNo,
      };
      this.$api.product.GetProduceCraftWorkTaskDetail(_data).then((res) => {
        this.equipment = res.equipmentDataList;
        this.assisList = res.assistantList;
        this.assisList.forEach((e) => {
          e.employeeCode = e.employeeNo;
        });
        this.machiaForm = res.baseData;
        this.reasonDataList = res.exceptionReasonList;
        this.machiaForm.exceptionDataList = res.exceptionDataList;
        this.machiaForm.mainMaterialDataList = res.mainMaterialDataList;
        this.machiaForm.ingredientsDataList = res.ingredientsDataList;
        this.machiaForm.pageDetailDataList = res.pageDetailDataList;
        this.machiaForm.exceptionDataList.forEach((item) => {
        item.beginPageNo = Number(item.beginPageNo);
        item.endPageNo = Number(item.endPageNo);
        item.exceptionReason = item.exceptionReason.split(',')
      });
        this.machiaForm.produceUseTime = this.timeFn(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        // this.machiaForm.workShiftNo = 'BC0019'
        this.showAddDialog = true;
      });
    },

    addExecp() {
      this.machiaForm.exceptionDataList.push({
        index: this.index,
        beginPageNo: 0,
        endPageNo: 0,
        exceptionNumberSegment: "",
        exceptionType: this.ExceptionTypeList[0].exceptionType,
        exceptionReason: "",
      });
      this.index++;
      console.log(this.machiaForm.exceptionDataList);
    },

    //添加页码明细
    handleAddPage() {
      this.machiaForm.pageDetailDataList.push({
        index: this.indexPage,
        pageFileName: "",
        totalPageCount: 0,
        beginNo: 0,
        endNo: 0,
        remark: "",
      });
      this.indexPage++;
    },
    //计算
    productMeter() {
      this.machiaForm.productMeters =
        Number(this.machiaForm.scrapMeters) +
        Number(this.machiaForm.finishedMeters);
      this.machiaForm.passCount =
        Number(this.machiaForm.inspectCount) -
        Number(this.machiaForm.noPassCount);
      this.machiaForm.percentDefective =
        (Number(this.machiaForm.noPassCount) /
          Number(this.machiaForm.inspectCount)) *
        100;
    },

    //计算成品米数
    calculation() {
      if (this.type == "丝网") {
        if (this.machiaForm.printFace && this.machiaForm.printCount) {
          this.machiaForm.sW_ProductMeters =
            (this.machiaForm.printFace * this.machiaForm.printCount) / 1000;
        } else {
          this.machiaForm.sW_ProductMeters = "";
        }
      } else if (this.type == "模切") {
        if (this.machiaForm.knifeVersionSize && this.machiaForm.cutCount) {
          this.machiaForm.mQ_ProductMeters =
            (this.machiaForm.knifeVersionSize * this.machiaForm.cutCount) /
            1000;
        } else {
          this.machiaForm.mQ_ProductMeters = "";
        }
      } else if (this.type == "数码") {
        if (this.machiaForm.printPageCount && this.machiaForm.printPageSize) {
          this.machiaForm.sM_ProductMeters =
            (this.machiaForm.printPageCount * this.machiaForm.printPageSize) /
            1000;
        } else {
          this.machiaForm.sM_ProductMeters = "";
        }
      } else if (this.type == "检验") {
        if (this.machiaForm.inspectCount && this.machiaForm.noPassCount) {
          this.machiaForm.percentDefective =
            (this.machiaForm.noPassCount/this.machiaForm.inspectCount) * 100;
        } else {
          this.machiaForm.percentDefective = "";
        }
      }
    },
    getChangeTime() {
      this.machiaForm.meetingSumTime =
        Number(this.machiaForm.meetingCount) * 30;
      this.machiaForm.printingDownSumTime =
        Number(this.machiaForm.printingDownCount) * 30;
      this.machiaForm.eatUseSumTime = Number(this.machiaForm.eatCount) * 30;
      this.machiaForm.actualWorkTime =
        this.machiaForm.produceUseTime -
        (this.machiaForm.eatUseSumTime +
          this.machiaForm.printingDownSumTime +
          this.machiaForm.meetingSumTime +
          Number(this.machiaForm.maintainTime) +
          Number(this.machiaForm.standbyTime) +
          Number(this.machiaForm.assistTime) +
          Number(this.machiaForm.debugMachineTime));
    },

    doneWork(row) {
      this.opsid = 0;
      this.rowID = row.workTaskID;
      this.$confirm("是否确定完成该作业?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          console.log(111)
          this.saveMachina();
        })
        .catch(() => {});
    },

    //工作效率计算
    efficiency(){
      this.machiaForm.actualWorkTime = this.machiaForm.taskUseTime-this.machiaForm.otherUseTime
      if(this.type == '印刷'){
        this.machiaForm.workEfficiency =Math.round((Number(this.machiaForm.produceMeters)/Number(this.machiaForm.actualWorkTime))*60)
        console.log(this.machiaForm.workEfficiency)
      }else if(this.type == '模切'){

      }else if(this.type == '采集'){
        this.machiaForm.workEfficiency =Math.round((Number(this.machiaForm.productQuantity)/Number(this.machiaForm.actualWorkTime))*60)
      }else if(this.type == '检验'){
        this.machiaForm.workEfficiency =Math.round((Number(this.machiaForm.inspectMeters)/Number(this.machiaForm.actualWorkTime))*60)
      }
      this.$forceUpdate()
    },

    // doneWork(item3) {
    //   this.$confirm('完成后不可修改，是否完成', {
    //     confirmButtonText: '确定',
    //     cancelButtonText: '取消',
    //     type: 'warning'
    //   }).then(() => {
    //     this.$api.product.FinishedProduceCraftWorkTask({
    //       workTaskID: item3.workTaskID
    //     }).then((res) => {
    //       this.getList()
    //       this.$message({
    //         type: 'success',
    //         message: '完成成功!'
    //       })
    //     })
    //   })
    // },

    fnishGY() {
      for (let i = 0; i < this.selectItem.workTaskList.length; i++) {
        const e = this.selectItem.workTaskList[i];
        if (e.craftWorkState === 0) {
          this.$message({
            type: "warning",
            message: "还有未完成的作业任务, 请先完成作业!",
          });
          return;
        }
      }
      this.$confirm("完成该工艺后, 不能再新增作业", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$api.product
          .FinishedProduceCraftTask({
            craftTaskNo: this.selectItem.craftTaskNo,
          })
          .then((res) => {
            this.$message({
              type: "success",
              message: "完成成功!",
            });
            this.getList();
          });
      });
    },

    //页码明细选择事件
    handlePageChange(e) {
      this.pageChecked = e;
    },

    //删除页码明细
    handleDeletePage() {
      if (this.pageChecked.length < 1) {
        this.$message.warning("请选择要删除的明细");
      } else {
        this.pageChecked.forEach((j) => {
          if (j.recordID) {
            this.machiaForm.pageDetailDataList =
              this.machiaForm.pageDetailDataList.filter((e) => {
                return e.recordID != j.recordID;
              });
          } else {
            this.machiaForm.pageDetailDataList =
              this.machiaForm.pageDetailDataList.filter((e) => {
                return e.index != j.index;
              });
          }
        });
        this.$forceUpdate();
      }
    },

    //辅料明细选择事件
    handleMaterialChange(e) {
      this.materiaChecked = e;
    },

    //删除辅料明细
    handleDeleteMaterial() {
      if (this.materiaChecked.length < 1) {
        this.$message.warning("请选择要删除的辅料");
      } else {
        this.materiaChecked.forEach((j) => {
          this.machiaForm.ingredientsDataList =
            this.machiaForm.ingredientsDataList.filter((e) => {
              return e.stockGoodsID != j.stockGoodsID;
            });
        });
        this.$forceUpdate();
        console.log(this.machiaForm.ingredientsDataList);
      }
    },

    //异常明细选中事件
    handleAbnormalChange(e) {
      this.abnormalChecked = e;
    },

    //删除异常明细
    handleDeleteAbnormal() {
      if (this.abnormalChecked.length < 1) {
        this.$message.warning("请选择要删除的明细");
      } else {
        this.abnormalChecked.forEach((j) => {
          if (j.exceptionID) {
            this.machiaForm.exceptionDataList =
              this.machiaForm.exceptionDataList.filter((e) => {
                return e.exceptionID != j.exceptionID;
              });
          } else {
            this.machiaForm.exceptionDataList =
              this.machiaForm.exceptionDataList.filter((e) => {
                return e.index != j.index;
              });
          }
        });
        this.$forceUpdate();
      }
    },

    // 新建
    productCopy() {
      const item2 = this.selectItem;
      let state = false;
      for (let work = 0; work < item2.workTaskList.length; work++) {
        if (item2.workTaskList[work].craftWorkState !== 1) {
          this.$confirm("还有未完成的作业，是否新建", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            const { saleOrderNo, produceTaskBillNo, craftTaskNo } = item2;
            this.$api.product
              .CreateProduceCraftWorkTask({
                saleOrderNo: saleOrderNo,
                produceTaskBillNo: produceTaskBillNo,
                craftTaskNo: craftTaskNo,
              })
              .then((res) => {
                this.$message({
                  type: "success",
                  message: "新建成功!",
                });
                this.getList();
                // this.setSCZY(item2, index2, index)
              });
          });
          break;
        } else {
          state = true;
        }
      }
      if (state || item2.workTaskList.length === 0) {
        const { saleOrderNo, produceTaskBillNo, craftTaskNo } = item2;
        this.$api.product
          .CreateProduceCraftWorkTask({
            saleOrderNo: saleOrderNo,
            produceTaskBillNo: produceTaskBillNo,
            craftTaskNo: craftTaskNo,
          })
          .then((res) => {
            this.$message({
              type: "success",
              message: "新建成功!",
            });
            this.getList();
            // this.setSCZY(item2, index2, index)
          });
      }
    },

    stopOne(item3) {
      this.$confirm("是否删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$api.product
          .DeleteProduceCraftWorkTask({
            workTaskID: item3.workTaskID,
          })
          .then((res) => {
            this.$message({
              type: "success",
              message: "删除成功!",
            });
            this.getList();
          })
          .catch(() => {});
      });
    },
    getList() {
      const _data = {
        produceTaskBillNo: this.$route.query.produceTaskBillNo,
        produceEquipment: this.$route.query.equipmentNo,
        saleOrderNo: this.productFrom.baseData.orderNo,
        produceBillType: 0,
        produceBillState: -1,
        taskProduceState: -1,
        craftWorkState: -1,
      };
      this.$api.product.GetProduceCraftWorkTasksForOrder(_data).then((res) => {
        res.forEach((e) => {
          e.craftTaskList.forEach((e2) => {
            e2.workTaskList.forEach((e3) => {
              this.$set(e3, "isShow", true);
            });
            this.$set(e2, "isShow", true);
          });
          this.$set(e, "isShow", true);
        });
        res.forEach((e) => {
          if (e.produceTaskBillNo === this.$route.query.produceTaskBillNo) {
            const a = [];
            a.push(e);
            this.productList = a;
          }
        });
        // this.productList = res
        this.loading.close();
        this.selectDD = this.productList[0];
        if (JSON.stringify(this.selectItem) !== "{}") {
          this.productList.forEach((e) => {
            if (e.produceTaskBillNo === this.selectDD.produceTaskBillNo) {
              e.craftTaskList.forEach((e1) => {
                if (e1.craftTaskNo === this.selectItem.craftTaskNo) {
                  this.selectItem.workTaskList = e1.workTaskList;
                  this.selectItem.craftTaskState = e1.craftTaskState;
                  this.selectItem.craftTaskNo = e1.craftTaskNo;
                }
              });
            }
          });
          // this.selectDD = this.productList[0]
        } else {
          this.selectItem = res[0].craftTaskList[0];
        }
        // this.selectDD = this.productList[0]
        // this.selectItem = this.productList[0].craftTaskList[0]
      });
    },
    getBC() {
      const _d = {
        isDelete: 0,
        isDisable: 0,
        likeWords: "",
        pageIndex: 1,
        pageSize: 30,
      };

      this.$api.system.GetMatchPageProductClasss(_d).then((res) => {
        this.bcList = res.list;
      });
    },
    chsngeSelect(item, DD) {
      this.selectDD = DD;
      this.selectItem = item;
    },
    getOrderInfo() {
      const parmas = {
        saleOrderID: this.$route.query.orderID,
        saleOrderNo: this.$route.query.saleOrderNo,
      };
      this.$api.business
        .GetSaleOrderDetail(parmas)
        .then((res) => {
          this.productFrom = res;
          this.getList();
        })
        .catch(() => {});
    },

    // 控制标签内容层显示隐藏
    shrink(item) {
      this.$set(item, "isShow", !item.isShow);
    },
    // 初始化订单数据
    getInitOrder(oldOrderNo) {},
    // 返回
    Back() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="scss" scoped>
.lNavt {
  padding-right: 4px;
  background: #f7f8fa;

  .itemCon {
    display: flex;
    margin: 10px;
    padding: 0 5px;
    width: 100%;
  }
}

.colorList {
  margin-top: 10px;

  li {
    border: 1px solid #eeeeef;
    margin-bottom: 10px;

    .fName {
      position: relative;

      &:before {
        content: "";
        position: absolute;
        left: 0;
        height: 22px;
        border-left: 3px solid #3f61f1;
        top: -1px;
      }
    }

    .colorCon {
      line-height: 22px;
      padding: 16px;
    }
  }
}

.newLayeeCon {
  margin-top: 10px;

  .el-button {
    width: 100%;
  }
}

.tabCon {
  width: 100%;
  padding: 0 16px;
  .btnlist {
    display: flex;
    justify-content: end;
    padding: 0 16px;
    margin: 16px;
  }
}

.tagsBox {
  display: flex;
  flex: 1;
  height: 100%;
  width: 100%;

  .tagsRgBox {
    width: 320px;
    flex-shrink: 0;
    height: 100%;
    border-left: 1px solid #e6e6e6;
    background: #fff;
    overflow: auto;

    .tabBox {
      ul {
        li {
          width: 33.3%;
          text-align: center;
          height: 32px;
          line-height: 32px;
          border-right: 1px solid #e6e6e6;
          background: #f7f8faff;
          border-bottom: 1px solid #e6e6e6;
          cursor: pointer;

          &:last-child {
            border-right: none;
          }

          &.on {
            background: #fff;
            border-bottom: 1px solid #fff;
          }
        }
      }
    }
  }
}

.permain {
  // align-items: baseline;
  line-height: 40px;
  height: 40px;

  .input {
    width: 100%;
    height: 28px;
    line-height: 28px;
    border-radius: 4px 0 0 4px;
    border: 1px solid #dcdfe6;

    span {
      display: inline-block;
      font-size: 12px;
      height: 22px;
      line-height: 22px;
      padding: 2px 5px;
      background-color: #f5f6f9;
      margin: 2px 5px;
    }
  }

  .bgc57 {
    height: 28px;
    background-color: #f5f7fa;
    border-radius: 0px 4px 4px 0px;
    margin-left: -1px;
  }
}

.cwapper {
  flex: 1;
  flex-direction: column;
  margin-left: 8px;
  .vss {
    height: 100%;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    overflow: hidden;
  }
}

.infoSCDD {
  background-color: #fff;
  box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  border: 1px solid #e6e6e6;
  padding: 16px;
  margin-bottom: 8px;
  span {
    margin-right: 20px;
    color: #999aaa;
  }
}

.tableCon {
  border: 1px solid #e6e6e6;
}

.cHeader {
  text-align: start;
  font-weight: 600;
  line-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid #e6e6e6;
}

.fleft {
  border-right: 1px solid #d8d8d8;
  padding: 16px;
}

.fright {
  padding: 16px;
  .count {
    display: flex;
    align-items: center;
    color: #999aaa;
  }
  .el-form-item:not(:last-child) {
    margin-bottom: 8px;
  }
}

.subTipBtn {
  border-bottom: 1px #e6e6e6 solid;
  background: #f5f6f9;
  padding: 8px 16px;
}

.cenCon {
  width: 260px;
  height: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: #fff;
  border-right: 1px solid #e6e6e6;

  .itemCenter {
    margin: 10px 0;

    .cenItem {
      margin: 5px 0;
    }

    .carftItem {
      padding: 5px 0;
      font-size: 12px;

      &.active {
        background-color: #f7f8fa;

        .intax {
          background-color: #3f61f1;
          color: #ffffff;
        }

        .name_text {
          color: #3f61f1;
        }
      }

      div {
        margin: 10px;
        font-weight: 400;
        color: #999aaa;
        padding-left: 50px;
      }

      .name {
        padding-left: 0px;

        .name_text {
        }
      }

      .intax {
        display: inline-block;
        background: #f5f6f9;
        border-radius: 2px;
        padding: 5px;
        width: 40px;
        text-align: center;
        margin-right: 10px;
      }
    }
  }

  .addPeoduct {
    cursor: pointer;
    background-color: #3f61f1;
    text-align: center;
    color: #ffffff;
    border-radius: 4px;
    margin: 16px;
    padding: 10px 0;
  }
}

.PBinfo {
  width: 30%;
  margin: 0 10px;
  display: inline-block;
}

.colorPic {
  height: 100%;
  margin: 0 0 5px 0;
  overflow: hidden;

  .img_c {
    width: 250px;
    height: 250px;
    align-items: center;
    justify-content: center;
    display: flex;
    background-color: #e6e6e6;
    margin: 5px 5px;
    // text-align: center;
    position: relative;

    .text {
      position: absolute;
      top: 0;
      left: 0;
      font-size: 12px;
      font-weight: 400;
      color: #ffffff;
      line-height: 22px;
      background: #000000;
      padding: 2px 5px;
      border-radius: 0px 0px 4px 0px;
      opacity: 0.5;
    }

    .yulan {
      width: 24px;
      height: 24px;
      border-radius: 4px;
      position: absolute;
      bottom: 10px;
      right: 16px;
      z-index: 8;
      color: #fff;
      background: #7f7f7f;
    }

    .img_i {
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: 100%;
    }
  }
}

.subTip {
  border-bottom: 1px #e6e6e6 solid;
  background: #f5f6f9;
  padding: 13px 16px;
  margin-bottom: 10px;
}

.formBox {
  padding: 0 16px;

  .order {
    padding: 10px 0;
  }
}

.leftCon {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  width: 320px;
  padding: 0 0 16px;
  border-radius: 4px;
  border: 1px #e6e6e6 solid;
}

.cenright {
  flex: 1;
  background-color: #ffffff;
  height: 100%;
  overflow: auto;

  .zy_add {
    margin: 16px 16px;
  }

  .zy_item {
    background: #ffffff;
    border: 1px solid #eeeeee;
    margin: 0 0 16px;

    .zy_header {
      display: flex;
      align-items: center;
      background: #f5f6f9;
      padding: 5px 5px 5px 16px;

      span {
        margin-right: 20px;
        color: #999aaa;
      }
    }

    .zy_info {
      padding: 16px;
      display: flex;
      flex-wrap: wrap;
      color: #999aaa;
      .divt {
        width: 33%;
        margin: 8px 0;
      }

      .cot {
        width: 100%;
      }

      .bigdialogTbCon {
        width: 100%;
        border: 1px solid #eeeeee;

        .ht {
          line-height: 44px;
          width: 100%;
          background: #f7f8fa;
          margin: 0;
          padding: 0 16px;

          span {
            font-weight: 600;
            color: #333333;
          }
        }
      }
    }
  }
}

.orderForm {
  height: calc(100%);
  width: 100%;
}

.mainCenter {
  height: calc(100% - 52px);
  width: 100%;
  overflow-x: hidden;
  padding: 8px;
}

.container {
  height: 100%;
  width: 100%;
}

.tagCon {
  width: 100%;
  flex: 1;
  overflow-x: hidden;
  margin: 0px 0 0 10px;
  background-color: #ffffff;

  .cginfo {
    margin: 0 16px;
  }

  .selectCon {
    line-height: 44px;
    text-align: center;
    background: #ffffff;
    border-radius: 4px 4px 0px 0px;
    border: 1px solid #e6e6e6;

    span {
      display: inline-block;
      margin: 0 32px;
      font-size: 16px;
      line-height: 44px;
      font-weight: 600;
      color: #333333;
      cursor: pointer;

      &.select {
        color: #3f61f1;
        border-bottom: 2px solid #3f61f1;
      }
    }
  }

  .tagList {
    box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.05);
    border: 1px solid #e6e6e6;
    margin: 16px;

    .listNav {
      height: 44px;
      padding: 0 14px;
      background: #f5f6f9;
      border-bottom: 1px solid #e6e6e6;
    }

    .tagShow {
      background-color: #ffffff;
      border: 1px solid #e4e7ed;

      .tagBaseList {
        padding: 14px;
        padding-bottom: 8px;

        li {
          line-height: 24px;
          width: 50%;
          margin: 5px 0;
        }

        .titles {
          width: 100px;
        }
      }

      .layerTable {
        padding: 16px;
        padding-top: 0;

        .border {
          border: solid #ebeef5;
          border-width: 0 1px 0 1px;
        }
      }
    }
  }
}

.orderRemark {
  line-height: 24px;
  padding-bottom: 16px;
}

.orderContent {
  flex: 1;
}

.drgCard {
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #eeeeee;
  padding: 5px 0;
  text-align: center;
  // line-height: 44px;
  align-items: center;

  .line_div {
    width: 120px;

    &.w15 {
      width: 15%;
    }

    &.w10 {
      width: 80px;
    }

    &.mlr10 {
      margin: 0 10px 0 0;
    }
  }
}

.tableBox {
  margin-top: 10px;
  overflow: hidden;
  border: 1px #e6e6e6 solid;
  border-bottom: none;
  .bigdialogTable {
    span {
      display: inline-block;
      text-align: center;
      font-weight: bold;
      width: 120px;
      &.w15 {
        width: 15%;
      }

      &.w10 {
        width: 10%;
      }
    }
  }

  .tt {
    height: 38px;
    line-height: 38px;
    background: #f7f8fa;
    padding-left: 16px;
  }

  .title {
    border-radius: 0;
    border: 1px solid #e6e6e6;
  }
}

::v-deep .formItem {
  .el-form-item {
    margin-bottom: 0;
    color: #999aaa;
  }

  .min_item .el-form-item__label {
    line-height: 28px;
    color: #999aaa;
  }

  .min_item .el-form-item__content {
    line-height: 28px;
  }

  .el-form-item__label {
    line-height: 28px;
    color: #999aaa;
  }

  .el-form-item__content {
    line-height: 28px;
    height: 28px;
    color: #333;

    .el-input-group {
      vertical-align: initial;
      margin-top: 0;
    }
  }

  .el-select,
  .el-date-editor.el-input {
    width: 100%;
  }

  .el-textarea {
    vertical-align: middle;
  }
}
</style>
<style lang="scss">
.el-loading-mask {
  top: 0;
}

.operations {
  display: flex;
  align-items: center;
}
.operations i {
  padding-right: 5px;
}

.operations > span:first-child {
  padding-right: 5px;
}

.operations > span {
  font-weight: 400;
  color: #000;
  cursor: pointer;
}

.operations > span:last-child {
  padding-left: 5px;
}
</style>
